#pragma once
#include "serverrequest.h"
#include "clientcontext.h"
#include <boost/asio.hpp>

class CServerBasic : public IServerContext
{
public:
	CServerBasic();
	~CServerBasic();

private:
	IServerRequest*						m_pServerRequest;
	boost::asio::ip::tcp::acceptor*		m_pTcpListen;
	unsigned short int					m_nPort;

public:
	virtual bool __stdcall	GetContext(ServerContext sc, void* p);
	virtual bool __stdcall	FindClient(const char* pClientID, IClientContext** ppCC);

public:
	void		SetServerCommand(IServerRequest* pSvrReq);
	void		Start(boost::asio::io_service* pios);
	void		AcceptHandler(const boost::system::error_code& ec, CClientContext* pContext,
		boost::asio::io_service* pios);
	void		RecvHandler(const boost::system::error_code& ec, CClientContext* pContext,
		boost::asio::io_service* pios, size_t bytes_transferred);
};